<!DOCTYPE html>
<html lang="zh-CN"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      layout:decorator="model/boardModel">
<head>
  <link th:href="@{/bootstrap/css/bootstrap-datetimepicker.min.css}" rel="stylesheet" media="screen"/>
</head>

<body>

  <div th:fragment="pagenav" th:remove="tag">
    <div th:replace="model/nav :: pageheader ('控制台','控制台')"></div>
  </div>

  <div th:fragment="content" th:remove="tag">

    <div class="row">
      <div class="col-md-3">
        <div class="box box-primary">
          <div class="box-body box-profile">
            <img class="profile-user-img img-responsive img-circle" src="../../dist/img/guanli.jpg" alt="User profile picture"/>

            <h3 class="profile-username text-center" th:text="${session.authUser.nickName}">全换机</h3>

            <p class="text-muted text-center"><shiro:principal /></p>

            <ul class="list-group list-group-unbordered">
              <shiro:hasAnyRoles name="admin,sys_agency,sys_ka,sys_bd,sys_nationwide,sys_supervisor">
              <li class="list-group-item">
                <b>今日订单</b> <a class="pull-right" th:text="${total}">暂无</a>
              </li>
              <li class="list-group-item">
                <b>总额</b> <a class="pull-right" th:text="${totalPrice}">暂无数据</a>
              </li>
              </shiro:hasAnyRoles>
              <shiro:hasRole name="admin">
                <li class="list-group-item">
                  <b>代理商数</b> <a class="pull-right" th:text="${countAgency}">13,287</a>
                </li>
              </shiro:hasRole>
              <shiro:hasRole name="sys_agency">
              <li class="list-group-item">
                <b>KA数</b> <a class="pull-right" th:text="${countKa}">13,287</a>
              </li>
              </shiro:hasRole>
              <shiro:hasRole name="sys_ka">
                <li class="list-group-item">
                  <b>门店数</b> <a class="pull-right" th:text="${countStore}">13,287</a>
                </li>
              </shiro:hasRole>
            </ul>
           <!-- <a th:href="@{order/info}" class="btn btn-primary btn-block"><b>更多</b></a>-->
          </div>
          <!-- /.box-body -->
        </div>
      </div>
      <div class="col-md-9">
       <div class="nav-tabs-custom">
        <ul class="nav nav-tabs">
          <li class="active"><a href="#timeline" data-toggle="tab">用户信息</a></li>
          <li><a href="#settings" data-toggle="tab">设置</a></li>
        <!--  <shiro:hasAnyRoles name="sys_agency,sys_ka">
            <li><a href="#account" data-toggle="tab">财务明细</a></li>
          </shiro:hasAnyRoles>-->
        </ul>
        <div class="tab-content">


          <div class="active tab-pane" id="timeline">

            <shiro:hasAnyRoles name="admin,sys_nationwide">
              <form class="form-horizontal">
                <div class="form-group">
                  <label for="inputName" class="col-sm-2 control-label">名称</label>
                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" id="inputName" th:value="${user.nickName}" placeholder="Name"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">电话</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" th:value="${user.phone}" id="inputEmail" placeholder="Email"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputSkills" class="col-sm-2 control-label">角色</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" disabled="disabled" th:value="${roles}" id="inputSkills" placeholder="Skills"/>
                  </div>
                </div>
              </form>
            </shiro:hasAnyRoles>
            <shiro:hasRole name="sys_supervisor">
              <form class="form-horizontal">
                <div class="form-group">
                  <label for="inputName" class="col-sm-2 control-label">名称</label>
                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" id="inputName" th:value="${supervisor.supervisorName}" placeholder="Name"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">联系人</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" th:value="${supervisor.contactName}" id="inputEmail" placeholder="Email"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">电话</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" th:value="${supervisor.contactPhone}" id="inputEmail" placeholder="Email"/>
                  </div>
                </div>

                <div class="form-group">
                  <label for="inputSkills" class="col-sm-2 control-label">角色</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" disabled="disabled" th:value="${roles}" id="inputSkills" placeholder="Skills"/>
                  </div>
                </div>
              </form>
            </shiro:hasRole>
            <shiro:hasRole name="sys_agency">
              <form class="form-horizontal">
                <div class="form-group">
                  <label for="inputName" class="col-sm-2 control-label">名称</label>
                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" id="inputName" th:value="${agencyInfo.agencyName}" placeholder="Name"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">联系人</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" th:value="${agencyInfo.contactName}" id="inputEmail" placeholder="Email"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">电话</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" th:value="${agencyInfo.contactPhone}" id="inputEmail" placeholder="Email"/>
                  </div>
                </div>

                <div class="form-group">
                  <label for="inputSkills" class="col-sm-2 control-label">角色</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" disabled="disabled" th:value="${roles}" id="inputSkills" placeholder="Skills"/>
                  </div>
                </div>
              </form>
            </shiro:hasRole>
            <shiro:hasRole name="sys_bd">
              <form class="form-horizontal">
                <div class="form-group">
                  <label for="inputName" class="col-sm-2 control-label">名称</label>
                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" id="inputName" th:value="${bdInfo.cityAgencyName}" placeholder="Name"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">联系人</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" th:value="${bdInfo.contactName}" id="inputEmail" placeholder="Email"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">电话</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" th:value="${bdInfo.contactPhone}" id="inputEmail" placeholder="Email"/>
                  </div>
                </div>

                <div class="form-group">
                  <label for="inputSkills" class="col-sm-2 control-label">角色</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" disabled="disabled" th:value="${roles}" id="inputSkills" placeholder="Skills"/>
                  </div>
                </div>
              </form>
            </shiro:hasRole>
            <shiro:hasRole name="sys_ka">
              <form class="form-horizontal">
                <div class="form-group">
                  <label for="inputName" class="col-sm-2 control-label">名称</label>
                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" id="inputName" th:value="${kaInfo.kaName}" placeholder="Name"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">联系人</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" th:value="${kaInfo.contactName}" id="inputEmail" placeholder="Email"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">电话</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" disabled="disabled" th:value="${kaInfo.contactPhone}" id="inputEmail" placeholder="Email"/>
                  </div>
                </div>

                <div class="form-group">
                  <label for="inputSkills" class="col-sm-2 control-label">角色</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" disabled="disabled" th:value="${roles}" id="inputSkills" placeholder="Skills"/>
                  </div>
                </div>
              </form>
            </shiro:hasRole>
          </div>

          <div class="tab-pane" id="settings">
            <shiro:hasAnyRoles name="admin,sys_nationwide">
              <form class="form-horizontal" id="adminForm">
                <input type="hidden" name="userId" th:value="${user.userId}"/>
                <div class="form-group">
                  <label for="inputUser" class="col-sm-2 control-label">账户名</label>
                  <div class="col-sm-10">
                    <input  class="form-control" id="inputUser" readonly="readonly" th:name="userName" th:value="${user.userName}" placeholder="账户名"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputName" class="col-sm-2 control-label">名称</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" id="inputName" th:name="nickName" th:value="${user.nickName}" placeholder="名称"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPass" class="col-sm-2 control-label">密码</label>
                  <div class="col-sm-8">
                    <input type="password" class="form-control" id="inputPass" disabled="disabled" value="******" placeholder="密码"/>
                  </div>
                  <input type="button" id="changePass-but" class='btn btn-primary btn-sm' value="修改密码" />
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">电话</label>

                  <div class="col-sm-10">
                    <input type="text" class="form-control" th:name="phone" th:value="${user.phone}" id="inputEmail" placeholder="Email"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputSkills" class="col-sm-2 control-label">角色</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" disabled="disabled" th:value="${roles}" id="inputSkills" placeholder="Skills"/>
                  </div>
                </div>
                <div class="form-group">
                  <div class="col-sm-offset-2 col-sm-10">
                    <input type="button" class="btn btn-danger" id="submitAdminChange" value="提交" />
                  </div>
                </div>
              </form>
            </shiro:hasAnyRoles>
            <shiro:hasRole name="sys_supervisor">
              <form class="form-horizontal" id="supervisorModal">
                <input type="hidden" name="agencyId" th:value="${supervisor.supervisorId}"/>
                <div class="form-group">
                  <label for="inputUser" class="col-sm-2 control-label">账户名</label>
                  <div class="col-sm-10">
                    <input  class="form-control" id="inputUser" readonly="readonly" th:name="userName" th:value="${user.userName}" placeholder="账户名"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputName" class="col-sm-2 control-label">名称</label>
                  <div class="col-sm-10">
                    <input type="email" class="form-control" name="agencyName" id="inputName" th:value="${supervisor.supervisorName}" placeholder="名称"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPass" class="col-sm-2 control-label">密码</label>
                  <div class="col-sm-8">
                    <input type="password" class="form-control" id="inputPass" disabled="disabled" value="******" placeholder="密码"/>
                  </div>
                  <input type="button" id="changePass-agency" class='btn btn-primary btn-sm' value="修改密码" />
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">联系人</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" name="contactName" th:value="${supervisor.contactName}" id="inputEmail" placeholder="联系人"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">电话</label>
                  <div class="col-sm-10">
                    <input type="email" class="form-control" name="contactPhone" th:value="${supervisor.contactPhone}" id="inputEmail" placeholder="电话"/>
                  </div>
                </div>

                <div class="form-group">
                  <label for="inputSkills" class="col-sm-2 control-label">角色</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" disabled="disabled" th:value="${roles}" id="inputSkills" placeholder="Skills"/>
                  </div>
                </div>
                <div class="form-group">
                  <div class="col-sm-offset-2 col-sm-10">
                    <input type="button" class="btn btn-danger" id="submitSupervisorChange" value="提交" />
                  </div>
                </div>
              </form>
            </shiro:hasRole>
            <shiro:hasRole name="sys_agency">
              <form class="form-horizontal" id="agencyModal">
                <input type="hidden" name="agencyId" th:value="${agencyInfo.agencyId}"/>
                <div class="form-group">
                  <label for="inputUser" class="col-sm-2 control-label">账户名</label>
                  <div class="col-sm-10">
                    <input  class="form-control" id="inputUser" readonly="readonly" th:name="userName" th:value="${user.userName}" placeholder="账户名"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputName" class="col-sm-2 control-label">名称</label>
                  <div class="col-sm-10">
                    <input type="email" class="form-control" name="agencyName" id="inputName" th:value="${agencyInfo.agencyName}" placeholder="名称"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPass" class="col-sm-2 control-label">密码</label>
                  <div class="col-sm-8">
                    <input type="password" class="form-control" id="inputPass" disabled="disabled" value="******" placeholder="密码"/>
                  </div>
                  <input type="button" id="changePass-agency" class='btn btn-primary btn-sm' value="修改密码" />
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">联系人</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" name="contactName" th:value="${agencyInfo.contactName}" id="inputEmail" placeholder="联系人"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">电话</label>
                  <div class="col-sm-10">
                    <input type="email" class="form-control" name="contactPhone" th:value="${agencyInfo.contactPhone}" id="inputEmail" placeholder="电话"/>
                  </div>
                </div>

                <div class="form-group">
                  <label for="inputSkills" class="col-sm-2 control-label">角色</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" disabled="disabled" th:value="${roles}" id="inputSkills" placeholder="Skills"/>
                  </div>
                </div>
                <div class="form-group">
                  <div class="col-sm-offset-2 col-sm-10">
                    <input type="button" class="btn btn-danger" id="submitAgencyChange" value="提交" />
                  </div>
                </div>
              </form>
            </shiro:hasRole>
            <shiro:hasRole name="sys_bd">
              <form class="form-horizontal" id="agencyModal">
                <input type="hidden" name="agencyId" th:value="${bdInfo.agencyId}"/>
                <div class="form-group">
                  <label for="inputUser" class="col-sm-2 control-label">账户名</label>
                  <div class="col-sm-10">
                    <input  class="form-control" id="inputUser" readonly="readonly" th:name="userName" th:value="${user.userName}" placeholder="账户名"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputName" class="col-sm-2 control-label">名称</label>
                  <div class="col-sm-10">
                    <input type="email" class="form-control" name="agencyName" id="inputName" th:value="${bdInfo.cityAgencyName}" placeholder="名称"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPass" class="col-sm-2 control-label">密码</label>
                  <div class="col-sm-8">
                    <input type="password" class="form-control" id="inputPass" disabled="disabled" value="******" placeholder="密码"/>
                  </div>
                  <input type="button" id="changePass-agency" class='btn btn-primary btn-sm' value="修改密码" />
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">联系人</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" name="contactName" th:value="${bdInfo.contactName}" id="inputEmail" placeholder="联系人"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">电话</label>
                  <div class="col-sm-10">
                    <input type="email" class="form-control" name="contactPhone" th:value="${bdInfo.contactPhone}" id="inputEmail" placeholder="电话"/>
                  </div>
                </div>

                <div class="form-group">
                  <label for="inputSkills" class="col-sm-2 control-label">角色</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" disabled="disabled" th:value="${roles}" id="inputSkills" placeholder="Skills"/>
                  </div>
                </div>
                <div class="form-group">
                  <div class="col-sm-offset-2 col-sm-10">
                    <input type="button" class="btn btn-danger" id="submitAgencyChange" value="提交" />
                  </div>
                </div>
              </form>
            </shiro:hasRole>
            <shiro:hasRole name="sys_ka">
              <form class="form-horizontal" id="kaForm">
                <input type="hidden" name="kaId" th:value="${kaInfo.kaId}"/>
                <div class="form-group">
                  <label for="inputUser" class="col-sm-2 control-label">账户名</label>
                  <div class="col-sm-10">
                    <input  class="form-control" id="inputUser" readonly="readonly" th:name="userName" th:value="${user.userName}" placeholder="账户名"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputName" class="col-sm-2 control-label">名称</label>
                  <div class="col-sm-10">
                    <input type="email" class="form-control" name="kaName" id="inputName" th:value="${kaInfo.kaName}" placeholder="Name"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPass" class="col-sm-2 control-label">密码</label>
                  <div class="col-sm-8">
                    <input type="password" class="form-control" id="inputPass" disabled="disabled" value="******" placeholder="密码"/>
                  </div>
                  <input type="button" id="changePass-ka" class='btn btn-primary btn-sm' value="修改密码" />
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">联系人</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" name="contactName" th:value="${kaInfo.contactName}" id="inputEmail" placeholder="联系人"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">电话</label>

                  <div class="col-sm-10">
                    <input type="email" class="form-control" name="contactPhone" th:value="${kaInfo.contactPhone}" id="inputEmail" placeholder="电话"/>
                  </div>
                </div>

                <div class="form-group">
                  <label for="inputSkills" class="col-sm-2 control-label">角色</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" disabled="disabled" th:value="${roles}" id="inputSkills" placeholder="Skills"/>
                  </div>
                </div>
                <div class="form-group">
                  <div class="col-sm-offset-2 col-sm-10">
                    <input type="button" class="btn btn-danger" id="submitKaChange" value="提交" />
                  </div>
                </div>
              </form>
            </shiro:hasRole>
          </div>
          <div class="tab-pane" id="account">
            <shiro:hasAnyRoles name="sys_ka">
              <form class="form-horizontal" id="adminForm">
                <div class="form-group">
                  <label for="inputUser" class="col-sm-2 control-label">收入总金额</label>
                  <div class="col-sm-10">
                    <input  class="form-control" id="inputUser" readonly="readonly"  th:value="${accountInfo.totalMoney +'元'}" placeholder="账户名"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputName" class="col-sm-2 control-label">可提现金额</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" id="inputName" readonly="readonly"  th:value="${accountInfo.balanceMoney +'元'}" placeholder="名称"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail" class="col-sm-2 control-label">支出金额</label>

                  <div class="col-sm-10">
                    <input type="text" class="form-control" readonly="readonly"  th:value="${accountInfo.payMoney +'元'}" id="inputEmail" placeholder="Email"/>
                  </div>
                </div>
              </form>
            </shiro:hasAnyRoles>
          </div>
          <!-- /.tab-pane -->
        </div>
        <!-- /.tab-content -->
      </div>
      </div>
   </div>
   <div class="row">
      <div class="col-md-12">
        <div class="box box-primary">
          <div class="box-header with-border">
            <h3 class="box-title">月度订单走势</h3>
            <div class="box-tools pull-right">
              <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
            </div>
          </div>
          <!-- /.box-header -->
          <!-- form start -->
          <form id="queryForm" th:action="@{flow}" method="post">
            <div class="box-body">
              <div class="row">
                <div class="col-xs-3">
                  <div class="input-group date form_date" data-date="" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                    <input id="selmonth" th:name="month" class="form-control input-sm" type="text" th:value="${month}" readonly="readonly" placeholder="成交开始时间" />
                    <span class="input-group-addon" ><span class="glyphicon glyphicon-calendar"></span></span>
                  </div>
                </div>

                <!--<shiro:hasRole name="sys_nationwide">

                </shiro:hasRole>-->
                <input type="hidden" th:name="userId" th:value="${session.authUser.userId}"/>
                <div class="col-xs-3">
                  <button id="btn-query" type="button" class="btn btn-primary pull-right btn-sm">查询
                  </button>
                </div>

              </div>
            </div>
            <!-- /.box-body -->

            <div class="box-footer">

            </div>
          </form>

          <div id="main" class="box-body" style="height:400px;">

          </div>
        </div>
      </div>
    </div>
    <div class="modal fade" id="changeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header" style="background-color: #307095;">
            <button type="button" class="close" data-dismiss="modal" id="btn_close" >
              <span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
            </button>
            <h4 class="modal-title" id="myModalLabel">修改密码</h4>
          </div>

          <div class="modal-body">
            <form class="form-horizontal"  id="changepassForm"  method="post">
              <input type="hidden" name="userId" th:value="${user.userId}" />
              <div class="form-group">
                <label  class="col-sm-3 control-label">原密码</label>
                <div class="col-sm-4">
                  <input type="password" id="oldPass" class="form-control" name="oldPass"  placeholder="原密码"/>
                </div>
              </div>
              <div class="form-group">
                <label  class="col-sm-3 control-label">新密码</label>
                <div class="col-sm-4">
                  <input type="password" class="form-control" id="newPass"  name="newPass"  placeholder="新密码"/>
                </div>
              </div>
              <div class="form-group">
                <label  class="col-sm-3 control-label">再次输入</label>
                <div class="col-sm-4">
                  <input type="password" class="form-control" id="repass" name="repass"  placeholder="再次输入"/>
                </div>
              </div>
            </form>

            <div class="modal-footer">
              <button type="submit" id="change-submit"  class="btn btn-primary">确定</button>
            </div>
          </div>
        </div>
      </div>
    </div>
    <script th:src="@{/charts/echarts.js}"></script>
    <script th:src="@{/charts/shine.js}"></script>
    <script type="text/javascript" th:src="@{/bootstrap/js/bootstrap-datetimepicker.js}" charset="UTF-8"></script>
    <script type="text/javascript" th:src="@{/bootstrap/js/locales/bootstrap-datetimepicker.zh-CN.js}" charset="UTF-8"></script>
    <script >
        $(function () {
            $("#changePass-but").click(function () {
                $("#oldPass").val(null);
                $("#changeModal").modal("show");
            })
            $("#changePass-agency").click(function () {
                $("#oldPass").val(null);
                $("#changeModal").modal("show");
            })
            $("#changePass-ka").click(function () {
                $("#oldPass").val(null);
                $("#changeModal").modal("show");
            })
            $("#change-submit").click(function () {
              if($("#newPass").val()==$("#repass").val()){
                  $.ajax({
                      url: '/user/changePassword',
                      type: 'POST',
                      data: $("#changepassForm").serialize(),
                      dataType: "json",
                      cache: "false",
                      success: function (result) {
                          if (result.result == 200) {
                              toastr.success(result.msg);
                              $("#changeModal").modal("hide");
                              //TODO修改成功重新登录
                          } else {
                              toastr.error(result.msg);
                          }
                      },
                      error: function (err) {
                          toastr.error("网络错误...");
                      }
                  });
              }else{
                  alert("请输入相同的新密码");
              }
            });
            $("#submitSupervisorChange").click(function () {
                $.ajax({
                    url: '/region/edit',
                    type: 'POST',
                    data: $("#supervisorModal").serialize(),
                    dataType: "json",
                    cache: "false",
                    success: function (result) {
                        if (result.result == 200) {
                            toastr.success(result.msg);
                            window.location.reload();
                        } else {
                            toastr.error(result.msg);
                        }
                    },
                    error: function (err) {
                        toastr.error("网络错误...");
                    }
                });
            })
            $("#submitAdminChange").click(function () {
                $.ajax({
                    url: '/user/edit',
                    type: 'POST',
                    data: $("#adminForm").serialize(),
                    dataType: "json",
                    cache: "false",
                    success: function (result) {
                        if (result.result == 200) {
                            toastr.success(result.msg);
                            window.location.reload();
                        } else {
                            toastr.error(result.msg);
                        }
                    },
                    error: function (err) {
                        toastr.error("网络错误...");
                    }
                });
            })
            $("#submitAgencyChange").click(function () {
                $.ajax({
                    url: '/agency/edit',
                    type: 'POST',
                    data: $("#agencyModal").serialize(),
                    dataType: "json",
                    cache: "false",
                    success: function (result) {
                        if (result.result == 200) {
                            toastr.success(result.msg);
                            window.location.reload();
                        } else {
                            toastr.error(result.msg);
                        }
                    },
                    error: function (err) {
                        toastr.error("网络错误...");
                    }
                });
            })
            $("#submitKaChange").click(function () {
                $.ajax({
                    url: '/ka/edit',
                    type: 'POST',
                    data: $("#kaForm").serialize(),
                    dataType: "json",
                    cache: "false",
                    success: function (result) {
                        if (result.result == 200) {
                            toastr.success(result.msg);
                            window.location.reload();
                        } else {
                            toastr.error(result.msg);
                        }
                    },
                    error: function (err) {
                        toastr.error("网络错误...");
                    }
                });
            })
        });
        $('.form_date').datetimepicker({
            format: 'yyyy-mm',
            autoclose: true,
            todayBtn: true,
            startView: 'year',
            minView:'year',
            maxView:'decade',
            language:  'zh-CN',
            startDate:'2017-05',
            endDate:new Date()
        });
        $(function () {

            var chart = echarts.init(document.getElementById('main'), 'shine');


            // 指定图表的配置项和数据
            option = {
                tooltip: {
                    trigger: 'axis'
                },
                title: {
                    text: '月度订单量走势'
                },
                toolbox: {
                    show: true,
                    feature: {
                        dataZoom: {},
                        dataView: {readOnly: false},
                        magicType: {type: ['line', 'bar']},
                        restore: {},
                        saveAsImage: {}
                    }
                },
                legend: {
                    data:[]
                },
                xAxis:  {
                    type: 'category',
                    boundaryGap: false,
                    data: []
                },
                yAxis: {
                    type: 'value',
                    axisLabel: {
                        formatter: '{value} '
                    }
                },
                series: []

            };


            // 使用刚指定的配置项和数据显示图表。
            chart.setOption(option);
            window.onresize = chart.resize;


            // 异步加载数据
            getdata();


            function getdata(){
                chart.showLoading();
                $.post( 'rp/order/flow',
                    $("#queryForm").serialize(),
                    function (datas) {
                        var data = $.parseJSON(datas);
                        var arencyName = [];
                        var arrayObj = [];
                        $.each(data.orders, function (index, obj) {
                            arencyName.push(obj.provinceName);
                            arrayObj.push({
                                name: obj.provinceName,
                                type: 'line',
                                data: obj.goodsSum,
                                markPoint: {
                                    data: [
                                        {type: 'max', name: '最大值'},
                                        {type: 'min', name: '最小值'}
                                    ]
                                },
                                markLine: {
                                    data: [
                                        {type: 'average', name: '平均值'}
                                    ]
                                }
                            });
                        });
                        var month = $('#selmonth').val();
                        chart.hideLoading();
                        // 填入数据
                        chart.setOption({
                            title: {
                                subtext: month
                            },
                            legend: {
                                data: arencyName
                            },
                            xAxis: {
                                type: 'category',
                                boundaryGap: false,
                                data: data.day
                            },
                            series: arrayObj
                        });
                    });
            }

        })

    </script>
</div>
</body>
</html>
